bitkeeper revision 1.1279 (42546416zxlkOnJgFX_0JvQ0FjNFDw)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 6 Apr 2005 22:35:02 +0000 (22:35 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 6 Apr 2005 22:35:02 +0000 (22:35 +0000)
Fix address canonicalisation in do_set_segment_base().
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/x86_64/mm.c
xen/include/asm-x86/x86_64/page.h

index 7d15496d1ed816253d25c5fe61a4633a743717db..d56b02fdbab95ef5423e417e41c76bcda01ed958 100644 (file)
@@ -249,8 +249,7 @@ long do_set_segment_base(unsigned int which, unsigned long base)
 {
     struct exec_domain *ed = current;
 
-    /* Canonicalise the base address. */
-    base |= ~VADDR_MASK;
+    base = canonicalise_virt_address(base);
 
     switch ( which )
     {
index 029635e3bfedf4ad3982bb614ee136d13ba7a578..d4731b65f446f85ded2ce6db6d6b5e6c62197aa1 100644 (file)
@@ -98,6 +98,15 @@ typedef l4_pgentry_t root_pgentry_t;
 #define L3_DISALLOW_MASK ((cpu_has_nx?0:(1UL<<63)) | (7UL << 7))
 #define L4_DISALLOW_MASK ((cpu_has_nx?0:(1UL<<63)) | (7UL << 7))
 
+#ifndef __ASSEMBLY__
+static inline unsigned long canonicalise_virt_address(unsigned long v)
+{
+    v &= VADDR_MASK;
+    if ( v & (1UL << (VADDR_BITS - 1)) )
+        v |= ~VADDR_MASK;
+}
+#endif /* !__ASSEMBLY__ */
+
 #endif /* __X86_64_PAGE_H__ */
 
 /*